﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <link href="./css/tie.css" rel="stylesheet" type="text/css" />    

    <title>Página de Contactos</title>
</head>
<body>
    <table id="form_canvas" class="MyMatrix_canvas">
        <tr>
            <td>
                <!-- HEADER CONTENT /-->
                <table id="MyMatrix_header" class="MyMatrix_header">
                    <!-- First header table row /-->
                    <tr>
                        <td id="MyMatrix_headerDate">
                            <div id="MyMatrix_header_currentdate">
                                <script type="text/javascript" src="scripts/date.js"></script>
                            </div>
                        </td>
                        <td id="MyMatrix_tracker">
                            <script src="scripts/writePath.js" type="text/javascript"></script>
                            <div style="float: right;">
                                <a href="{{ URL }}">{{ URL_LinkText }}</a> {{User.nickname}}{{user}}</div>
                        </td>
                    </tr>
                    <!-- Second header table row /-->
                    <tr>
                        <td>
                            <div style="float: left;">
                                <img alt="" src="images/TieLogo.png" class="Logo" /></div>
                        </td>
                        <td>
                            <table class="boxNav" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="celNavLeft">
                                    </td>
                                    <td width="10px">
                                        &nbsp;
                                    </td>
                                    <td id="MyMatrix_menu_1" class="celNavMenu">
                                        <a href="/loadactivities">Actividades</a>
                                    </td>
                                    <td width="50">
                                        &nbsp;
                                    </td>                                    
                                    <td id="Td2" class="celNavMenu">
                                        <a href="/loadroutes">Rotas</a>
                                    </td>                                              
                                    <td width="10">
                                        &nbsp;
                                    </td>
                                    <td id="MyMatrix_menu_2" class="celNavMenu">
                                        <a href="/loadentities">Entidades</a>
                                    </td>
                                    <td width="10">
                                        &nbsp;
                                    </td>
                                    <td id="MyMatrix_menu_3" class="celNavMenu">
                                        <a href="/loadcontacts">Contactos</a>
                                    </td>
                                    <td width="10">
                                        &nbsp;
                                    </td>
                                    <td class="celNavRight">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <!-- BODY CONTENT /-->
                <table id="MyMatrix_body" class="MyMatrix_body">
                    <tr>
                        <td>
                            <div id="content">
                                <table>
                                    <tr>
                                        <td valign="top">
                                            <span class="title">Lista de contactos</span>
                                            <br /><br />
                                            <span class="titleHighlight">Use esta página para consultar, criar, alterar ou remover contactos.</span>
                                            <br /><br />
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td class="celSepHColorLeft"/>
                                        <td class="celSepHColorCenter"/>
                                        <td class="celSepHColorRight"/>
                                    </tr>
                                </table>
                                {% if ContactsCount %} 
                                <table class="ListTable">
                                    <tr>
                                        <th>Editar</th>
                                        <th>Titulo</th>
                                        <th>Nome</th>
                                        <th>Data de nascimento</th>
                                        <th>Telemóvel</th>
                                        <th>Email</th>
                                    </tr>
                                    {% for CurrContact in Contacts %}
                                    <tr>
                                        <td><a class="MyLink" class="Edit" href="/loadcontacts?id={{CurrContact.key.id}}">editar</a></td>
                                        <td>{{CurrContact.Title}}</td>
                                        <td>{{CurrContact.Name}}</td>
                                        <td>{{CurrContact.BirthDate}}</td>
                                        <td>{{CurrContact.MobilePhone}}</td>
                                        <td><a class="MyLink" href="mailto:{{CurrContact.Email}}">{{CurrContact.Email}}</a></td>
                                    </tr>
                                    {% endfor %}
                                </table>
                                <hr />
                                <p style="text-align:right; font-size:smaller">
                                    Número total de entidades: {{ContactsCount}}
                                </p>
                                {% endif %}                                                                
                                <div class="headline">
                                    <p class="subtitle">Criar/editar contactos</p> </div>
                                {% if user %}
                                <form style="width:100%" action="{{Action}}" method="post">
                                <table class="EditTable">
                                    <tr>
                                        <td class="EditTable_Col1"><label for="Title">Título</label></td>
                                        <td class="EditTable_Col2"><input class="EditField" type="text" name="Title" id="Title" value="{{edContact.Title}}"/></td>
                                        <td class="EditTable_Col3"><label for="Name">Nome</label></td>
                                        <td class="EditTable_Col4"><input class="EditField" type="text" name="Name" id="Name" value="{{edContact.Name}}"/></td>
                                        <td rowspan="4" class="EditTable_Col5">
                                        Criado por: {{edContact.CreatedBy}} <br />
                                        Data de criação: {{edContact.CreatedOn|date:"d.m.Y"}} <br /><br />
                                        Actualizado por: {{edContact.UpdatedBy}} <br />
                                        Data de actualização: {{edContact.UpdatedOn|date:"d.m.Y"}}
                                        {% if EditMode %} 
                                            <br /><br />
                                            <a class="MyLink" href="/loadrelationships?ent_id={{edContact.key.id}}&ent_type=Contact" runat="server">Entidades associadas</a>                                        
                                        {% endif %}                                                                                
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="EditTable_Col1"><label for="BirthDate">Nascido em</label></td>
                                        <td class="EditTable_Col2" colspan="1"><input class="EditField" type="text" name="BirthDate" id="BirthDate" value='{{edContact.BirthDate|date:"d/m/Y"}}'/></td>
                                        <td class="EditTable_Col3"><p>(dd/mm/aaaa)</p>
                                    </tr>
                                    <tr>
                                        <td class="EditTable_Col1"><label for="MobilePhone">Telemóvel</label></td>
                                        <td class="EditTable_Col2" colspan="1"><input class="EditField" type="text" name="MobilePhone" id="MobilePhone" value="{{edContact.MobilePhone}}"/></td>                                        
                                    </tr>                                    
                                        <td class="EditTable_Col1"><label for="Email">Email</label></td>
                                        <td class="EditTable_Col2" colspan="2"><input class="EditField" type="text" name="Email" id="Email" value="{{edContact.Email}}"/></td>                                        
                                    </tr>                                                                                   
                                    <tr>                                        
                                        <td colspan="5" align="right">
                                        {% if EditMode %} 
                                            <input type="submit" value="Actualizar contacto" /><br />
                                            <a href="/deletecontact?id={{edContact.key.id}}" runat="server">Eliminar</a>
                                        {% else %} 
                                            <input type="submit" value="Criar contacto" />
                                        {% endif%}                                                                                 
                                        </td>
                                    </tr>
                                </table>
                                </form>
                                {% else %} 
                                    Valide-se com o seu login para ver ou manusear contactos. 
                                {% endif%}
                            </div>
                        </td>
                    </tr>
                </table>
                <!-- FOOTER CONTENT -->
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td id="Td1" class="MyMatrix_footer">
                                <script src="scripts/PageLayout.js" type="text/javascript"></script>                            
                        </td>
                    </tr>
                </table>
                <!-- BASEBOARD-->
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="boxBaseboard">
                    <tr>
                        <td class="baseboard_left">
                            &nbsp;
                        </td>
                        <td class="baseboard_center">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="baseboard_txt">
                                <tr>
                                    <td style="text-align: left; width: 140px;">
                                        <img src="images/IPCALogo.png" alt="IPCA Logo" />
                                    </td>
                                    <td>
                                        <b>(Nuno Queirós - António Antunes - Miguel Barroso)
                                            <br />

                                            <script type="text/javascript" src="./Scripts/Year.js"></script>

                                            © IPCA</b> . Todos os Direitos Reservados.
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td class="baseboard_right">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
</html>
